Skip to content

[Fix] jsx-key: detect missing keys in return statement with ternary operator#3928

Merged
ljharb merged 1 commit into
jsx-eslint:masterfrom
hyeonbinHur:issue3925
Feb 18, 2026
Merged

[Fix] jsx-key: detect missing keys in return statement with ternary operator#3928
ljharb merged 1 commit into
jsx-eslint:masterfrom
hyeonbinHur:issue3925

Conversation

@hyeonbinHur
Copy link
Copy Markdown

Fix #3925

@hyeonbinHur
Copy link
Copy Markdown
Author

Invalid Test Cases (4)

Case Scenario AST Patterns Covered
1: Basic Pattern return + ternary in map with ArrowFunction • ArrowFunction + BlockStatement + ReturnStatement
• ConditionalExpression with JSX elements
• Missing key detection in ternary branches
2: Function Expression return + ternary in map with regular function • FunctionExpression + BlockStatement + ReturnStatement
• ConditionalExpression handling across function types
• Same logic applies to function() syntax
3: Array.from Method return + ternary in Array.from iteration • Array.from + checkFunctionsBlockStatement call
• ConditionalExpression in different iteration contexts
• Multiple iteration method support
4: Fragment Context return + ternary within Fragment (Original Issue) • Fragment + map + return + ternary pattern
• Real-world user scenario reproduction
• Issue #3925 exact replication

Valid Test Cases (1)

Case Scenario Corresponding Invalid Case
1: Proper Keys return + ternary with correct key props Invalid 1

@ljharb ljharb changed the title [Fix]: detect missing keys in return statement with ternary operator [Fix] jsx-key: detect missing keys in return statement with ternary operator Feb 18, 2026
@ljharb ljharb added the bug label Feb 18, 2026
@ljharb ljharb merged commit a116665 into jsx-eslint:master Feb 18, 2026
448 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

[Bug]: react/jsx-key rule is not applied when using return statement and ternary operator in iterator

2 participants